Add ETW event for project creation in ProjectSystemProjectFactory#80967
Add ETW event for project creation in ProjectSystemProjectFactory#80967jasonmalinowski merged 3 commits intomainfrom
Conversation
- Added ProjectCreated event (ID 20) to CodeAnalysisEventSource.Workspaces.cs - Event logs projectSystemName and filePath parameters - Added event call in ProjectSystemProjectFactory.CreateAndAddToWorkspaceAsync after project is added to workspace - Built and verified changes compile successfully Co-authored-by: jasonmalinowski <201340+jasonmalinowski@users.noreply.github.com>
| public static readonly CodeAnalysisEventSource Log = new(); | ||
|
|
||
| [Event(20, Message = "Project '{0}' created with file path '{1}'", Level = EventLevel.Informational)] | ||
| internal void ProjectCreated(string projectSystemName, string? filePath) => WriteEvent(20, projectSystemName, filePath ?? string.Empty); |
There was a problem hiding this comment.
@chsienki Should this be defined in this file or in the other Common file? It looks like other workspace events are being defined there, but then I'm not entirely sure what this file is doing specifically or what the intent is for the different provider names.
There was a problem hiding this comment.
IIRC these got shared because the ALC events are shared across the compiler and workspaces code. @RikkiGibson would probably remember better.
There's nothing inherently wrong with having the events be declared only in the workspaces layer but means we have to not re-use the ID for something else in the shared layer.
We should probably refactor this to have a shared ALC event source and then separate ones for compiler and workspaces. For now I would suggest just putting it in the shared layer for simplicity though.
There was a problem hiding this comment.
@copilot Can you move this addition to CodeAnalysisEventSource.Common.cs then?
There was a problem hiding this comment.
Done. Moved the ProjectCreated event to CodeAnalysisEventSource.Common.cs in commit 3a013db.
Per feedback from @jasonmalinowski and @chsienki, moved the ProjectCreated event definition from CodeAnalysisEventSource.Workspaces.cs to CodeAnalysisEventSource.Common.cs to keep event definitions in the shared layer for simplicity and avoid ID conflicts. Co-authored-by: jasonmalinowski <201340+jasonmalinowski@users.noreply.github.com>
Adds ETW instrumentation to log when projects are created and added to the workspace in
ProjectSystemProjectFactory.Changes
ProjectCreatedevent (ID 20) that logsprojectSystemNameandfilePathCreateAndAddToWorkspaceAsyncThe event follows the existing pattern used for analyzer reference logging and uses the next available event ID in the sequence. The event is defined in the shared
CodeAnalysisEventSource.Common.cslayer to avoid ID conflicts and maintain consistency with the architecture.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.